#pragma once

#include <vector>
#include <string>
#include <functional>
#include <unistd.h>
#include <iostream>

// typedef std::function<void (int, const std::string &, uint16_t)> _func_t;
using _func_t = std::function<void (int, const std::string &, uint16_t)>;

class Task
{
public:
    Task()
    {}

    Task(int fd, const std::string& ip, uint16_t port, _func_t func)
        :_fd(fd), _ip(ip), _port(port), _func(func)
    {}

    void operator()()
    {
        return _func(_fd, _ip, _port);
    }

    int _fd;
    std::string _ip;
    uint16_t _port;
    _func_t _func;
};